package com.smart.model.convert;

import com.smart.model.dtomapper.UnitDtoMapper;
import com.smart.model.domain.UnitDO;
import com.smart.model.vo.UnitVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class UnitConvert {

    public static List<UnitVO> buildUnitVoList(List<UnitDO> unitDOList) {
        if (CollectionUtils.isEmpty(unitDOList)) {
            return Lists.newArrayList();
        }
        List<UnitVO> unitVOList = new ArrayList<>();
        for (UnitDO unitDO : unitDOList) {
            unitVOList.add(UnitDtoMapper.INSTANCE.do2VO(unitDO));
        }

        return unitVOList;
    }
}
